package com.carson.data.zuul;

import lombok.Data;

import java.io.Serializable;

@Data
public class Result<T> implements Serializable {
    private static final long serialVersionUID = 1L;
    private int code = 0;
    private String message = "ok";
    private T data;

    public static <T> Result<T> ok(T data) {
        Result<T> result = new Result<>();
        result.setData(data);
        return result;
    }

    public static Result ok() {
        return new Result();
    }

    public boolean isOk() {
        return this.code == 0;
    }
}